package unicall.em.dtos;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

import unicall.em.utils.StringUtil;

public class SkillDto {
    
    private String id;
    
    private String tenantId;
    @NotEmpty(message="名称不能为空")
    @Size(max=16,message="名称最多为16个字符")
    private String name;
    //应用ID
    private String appId;
    //队列编号
    @Pattern(regexp="[1-9]+[0-9]*",message="队列编号为大于1的整数")
    private String queueId;
    //最大排队数
    private int maxNum;
    //排队等待音
    @NotEmpty(message="排队音不能为空")
    private String mediaId;
    //退出队列按键
    @NotEmpty(message="按键不能为空")
    private String exitKey;
    //排队超时时长
    private int timeoutLen;
    //排队超时音
    @NotEmpty(message="语音不能为空")
    private String timeoutMediaId;
    //继续排队按键
    @NotEmpty(message="按键不能为空")
    private String continuteKey;
    //最大排队次数
    private int maxQueueCount;
    //接通后播放提示音
    private String tipMediaId;
    //分配策略
    private String strategy;
    //未接听超时置闲时长
    private int noAnswerTimeout;
    //挂机后超时置闲时长
    private int acwTimeout;
    //是否开启顺振
    private int sequenceRing;
    //状态
    private String state;
    
    private Date createdAt;
    
    private Date updatedAt;
    
    private String creatorId;
    
    private String operatorId;
    
    
    public SkillDto(){
        
    }

    public String getQueueId() {
        return queueId;
    }

    public void setQueueId(String queueId) {
        this.queueId = queueId;
    }

    public int getMaxNum() {
        return maxNum;
    }

    public void setMaxNum(int maxNum) {
        this.maxNum = maxNum;
    }

    public String getMediaId() {
        return mediaId;
    }

    public void setMediaId(String mediaId) {
        this.mediaId = mediaId;
    }

    public String getExitKey() {
        return exitKey;
    }

    public void setExitKey(String exitKey) {
        this.exitKey = exitKey;
    }

    public int getTimeoutLen() {
        return timeoutLen;
    }

    public void setTimeoutLen(int timeoutLen) {
        this.timeoutLen = timeoutLen;
    }

    public String getTimeoutMediaId() {
        return timeoutMediaId;
    }

    public void setTimeoutMediaId(String timeoutMediaId) {
        this.timeoutMediaId = timeoutMediaId;
    }

    public String getContinuteKey() {
        return continuteKey;
    }

    public void setContinuteKey(String continuteKey) {
        this.continuteKey = continuteKey;
    }

    public int getMaxQueueCount() {
        return maxQueueCount;
    }

    public void setMaxQueueCount(int maxQueueCount) {
        this.maxQueueCount = maxQueueCount;
    }

    public String getTipMediaId() {
        return tipMediaId;
    }

    public void setTipMediaId(String tipMediaId) {
        this.tipMediaId = tipMediaId;
    }

    public String getStrategy() {
        return strategy;
    }

    public void setStrategy(String strategy) {
        this.strategy = strategy;
    }

    public int getNoAnswerTimeout() {
        return noAnswerTimeout;
    }

    public void setNoAnswerTimeout(int noAnswerTimeout) {
        this.noAnswerTimeout = noAnswerTimeout;
    }

    public int getAcwTimeout() {
        return acwTimeout;
    }

    public void setAcwTimeout(int acwTimeout) {
        this.acwTimeout = acwTimeout;
    }

    public int getSequenceRing() {
        return sequenceRing;
    }

    public void setSequenceRing(int sequenceRing) {
        this.sequenceRing = sequenceRing;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public String getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(String creatorId) {
        this.creatorId = creatorId;
    }

    public String getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(String operatorId) {
        this.operatorId = operatorId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    
    public Map<String,String> toParams(){
        Map<String,String> _params = new HashMap<String,String>();
        _params.put("id", this.id);
        _params.put("appId", this.appId);
        _params.put("maxQNum", this.maxNum+"");
        _params.put("fileName", this.mediaId);
        _params.put("key2ExitQ", this.exitKey);
        _params.put("waitTimeLen", this.timeoutLen+"");
        _params.put("timeOutFileName", this.timeoutMediaId);
        _params.put("key2Continue",this.continuteKey);
        _params.put("maxQCnt",this.maxQueueCount+"");
        _params.put("voiceStr",this.tipMediaId);
        _params.put("strategy", this.strategy);
        _params.put("noAnsSetFree",this.noAnswerTimeout+"");
        _params.put("callOverSetFree", this.acwTimeout+"");
        _params.put("sequenceSwi", this.sequenceRing+"");
        return _params;
    }
    
    
    public String getStateName(){
        Map<String,String> options = new HashMap<String,String>();
        options.put("ready", "待同步");
        options.put("rsync", "已同步");
        options.put("error", "同步错误");
        return StringUtil.trim(options.get(this.getState()));
    }
    
    public String getStrategyName(){
        Map<String,String> options = new HashMap<String,String>();
        options.put("1", "记忆轮转");
        options.put("2", "线性振铃");
        options.put("3", "优先级");
        options.put("4", "最小次数(日)");
        options.put("5", "最小次数(月)");
        options.put("6", "最长空闲");
        options.put("7", "累计时长(日)");
        options.put("8", "累计时长(月)");
        return StringUtil.trim(options.get(this.getStrategy()));
     
    }
    

    
    
}
